<?php
class Default_Model_DbTable_Themes extends Default_Model_DbTable_DbTableEntityAbstract
{
	protected $_db;
	protected $_primary = 'theme_id';
	/*
	protected $_referenceMap    = array(
        'FoodType' => array(
			'columns'       => 'food_type_id',
            'refTableClass' => 'Default_Model_DbTable_RecipeHasFoodTypes',
            'refColumns'    => 'food_type_id'
        )
    );
    */
	//protected $_dependentTables = array('Default_Model_DbTable_Roles');
	
    public function init()
    {
    	$this->_name = 'themes';
    	$this->_db = Zend_Db_Table::getDefaultAdapter();
    }
    
    public function addTheme($data)
    {
    	$this->insert($data);
    	return $this->getAdapter()->lastInsertId();
    }
    
    public function getThemeId($themeName)
    {
    	$select = $this->select()
    				   ->from($this, array('theme_id'))
    	               ->where("theme_name = ?", $foodTypeName);
    	               
    	$result = $this->fetchRow($select);
    	return $result;
    }
    
	public function getThemes()
    {
    	$select = $this->select()
    				   ->from($this, array('theme_id', 'theme_name', 'theme_latname'));
    	               
    	$result = $this->fetchAll($select);
    	return $result;
    }
    
    public function getThemeName($themeLatName)
    {
    	$select = $this->select()
    				   ->from($this, array('theme_name'))
    				   ->where("theme_latname = ?", $themeLatName);
    	               
    	$result = $this->fetchRow($select);
    	return $result;
    }
}